import { setToken } from '@/utils/cookie'

export const state = () => {
    return {
        list: [],
        roles:''
    }
}

export const mutations = {
    SET_LIST(state, arr) {
        state.list = arr
    }
}

export const actions = {
    //用户登录
    doLogin({},form) {
        const { data } = await this.$axios.post('users/user-login', form)
        setToken(data.data.token)
        return true
    },

    async getList({commit}){
        const {data} = await this.$axios.get(
            "users/user-list?pageSize=10"
        );
        commit("SET_LIST",data.data)
    }
}

export const getters = {
    
}